<?
session_name("MeuLogin");
session_start();

require("loga.php");

?>

<head>
<title>ECOMP - Colegiado de Engenharia de Computa&ccedil;&atilde;o UEFS.</title>
<meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
td img {display: block;}
</style>

<style type="text/css">
<!--
body,td,th {
	font-family: Century Gothic, Trebuchet MS, Verdana;
	font-size: 14px;
	color: #333333;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
a:link {
	color: #333333;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #333333;
}
a:hover {
	text-decoration: none;
	color: #666666;
}
a:active {
	text-decoration: none;
	color: #333333;
}
.style4 {font-size: 16px}
.style5 {
	font-size: 12px;
	font-family: Verdana;
	font-weight: bold;
}
-->
</style></head>


<!--Fireworks CS3 Dreamweaver CS3 target.  Created Sat Feb 07 20:56:19 GMT-0300 (Hora oficial do Brasil) 2009-->
</head>
<body bgcolor="#c8c8c8">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- fwtable fwsrc="lay_out pag UEFS.png" fwpage="Page 1" fwbase="col_ecomp.jpg" fwstyle="Dreamweaver" fwdocid = "1222939957" fwnested="0" -->
  <tr>
   <td><img src="spacer.gif" width="33" height="1" border="0" alt="" /></td>
   <td><img src="spacer.gif" width="732" height="1" border="0" alt="" /></td>
   <td><img src="spacer.gif" width="35" height="1" border="0" alt="" /></td>
   <td><img src="spacer.gif" width="1" height="1" border="0" alt="" /></td>
  </tr>

  <tr>
   <td colspan="3"><img name="col_ecomp_r1_c1" src="col_ecomp_r1_c1.jpg" width="800" height="236" border="0" id="col_ecomp_r1_c1" alt="" /></td>
   <td><img src="spacer.gif" width="1" height="236" border="0" alt="" /></td>
  </tr>
  <tr>
   <td rowspan="2"><img name="col_ecomp_r2_c1" src="col_ecomp_r2_c1.jpg" width="33" height="964" border="0" id="col_ecomp_r2_c1" alt="" /></td>
   <td valign="top" bgcolor="#FFFFFF">

<!-- Aqui a tabela -->
<!-- Aqui os metodos POST -->




<?

// nivel 2 - Administrador
if ($_SESSION["nivel"] == 2)
{



		if($_GET[ 'act' ]=="cadastrar") {

			  $conn = mysql_connect("localhost","tocolado_gt02","ecompgt02");
			  $banco = mysql_select_db("tocolado_ecomp");

			 // Grava na Tabela Disciplina

			  mysql_query("INSERT INTO Disciplina (id,nome, codigo, cargahoraria, semestre, Departamento_ID, TipoDisciplina_ID) VALUES (
			  NULL,
			  '{$_POST[ 'nome' ]}',
			  '{$_POST[ 'codigo' ]}',
			  '{$_POST[ 'cargahoraria' ]}',
			  '{$_POST[ 'semestre' ]}',
               '{$_POST[ 'departamento' ]}',
               '{$_POST[ 'tipodisciplina' ]}'
			  )");



			  print "<center>Disciplina criada com sucesso!</center>";
        }
		
        else  {
				?>
         			<form name="cad_aluno" method="post" action="?act=cadastrar">
                    <table width="383" border="0" align="center" cellpadding="3">
                      <tr>
                        <td colspan="2" align="center" valign="top"><span class="style4">Cadastrar Disciplina</span></td>
                      </tr>
                      <tr>
                        <td width="152" align="left">Nome:</td>
                        <td width="207" align="left"><input name="nome" type="text" id="nome" size="32" maxlength="80" /></td>
                      </tr>
                      <tr>
                        <td align="left">Codigo:</td>
                        <td align="left"><input name="codigo" type="text" id="codigo" size="32" maxlength="14" /></td>
                      </tr>

                      <tr>
                        <td align="left">Departamento:</td>
                        <td colspan="3" align="left"><select name="departamento" >
                          <option> Selecione o Departamento </option>
                          <?
                          $conn = mysql_connect("localhost","tocolado_gt02","ecompgt02");
                        $banco = mysql_select_db("tocolado_ecomp");
                        $re = mysql_query("SELECT ID,nome FROM Departamento;");

                          while($l = mysql_fetch_array($re)) { ?>

                          <option value= <? echo $l["ID"] ?>><? echo $l["nome"] ?></option>
                          <? } ?>

                        </select></td>
                      </tr>

                          <tr>
                        <td align="left">Tipo Disciplina:</td>
                        <td colspan="3" align="left"><select name="tipodisciplina" >
                          <option>Selecione o Tipo da Disciplina</option>
                          <?
                          $conn = mysql_connect("localhost","tocolado_gt02","ecompgt02");
                        $banco = mysql_select_db("tocolado_ecomp");
                        $re = mysql_query("SELECT ID,descricao FROM TipoDisciplina;");

                          while($l = mysql_fetch_array($re)) { ?>
                          }
                          <option value= <? echo $l["ID"] ?>><? echo $l["descricao"] ?></option>
                          <? } ?>

                        </select></td>
                      </tr>


                      <tr>
                        <td align="left">Carga Horaria:</td>
                        <td align="left"><input name="cargahoraria" type="text" id="cargahoraria" size="32" maxlength="40" /></td>
                      </tr>
                      <tr>
                        <td align="left">Semestre:</td>
                        <td align="left"><input name="semestre" type="text" id="semestre" size="32" maxlength="14" /></td>
                      </tr>

                      <tr>
                        <td colspan="2" align="center"><input type="submit" value="Cadastrar Disciplina"></td>
                     </tr>
                    </table>
				</form>
				<?
				}
} else
{
		echo '<br><br>Voce nao tem privilegios de Administrador do Sistema - Nivel 2
			<br><p><a href="page.php" class="style1">Voltar</a></p>';
}
?>

<a href="page.php"><img src="imgs/kack.gif" width="90" height="40" border="0" /></a>

<!-- Aqui a tabela -->
<!-- Aqui os metodos POST -->  </td>
   <td rowspan="2"><img name="col_ecomp_r2_c3" src="col_ecomp_r2_c3.jpg" width="35" height="964" border="0" id="col_ecomp_r2_c3" alt="" /></td>
   <td><img src="spacer.gif" width="1" height="876" border="0" alt="" /></td>
  </tr>
  <tr>
   <td><img name="col_ecomp_r3_c2" src="col_ecomp_r3_c2.jpg" width="732" height="88" border="0" id="col_ecomp_r3_c2" alt="" /></td>
   <td><img src="spacer.gif" width="1" height="88" border="0" alt="" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><div align="center"><span class="style5">Universidade Estadual De Feira de Santana - Colegiado de Engenharia de Computa&ccedil;&atilde;o &copy; 2009.</span></div></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
